package com.ifnk.portaljava.hlyt.utils;

import java.io.IOException;
import java.util.Properties;

public class PortalProperties {
	
	private PortalProperties(){
		
	}
	private static final Properties portal = new Properties();
	
	private static final String device_lookup_file_key = "devicelookupfile";
	private static final String device_lookup_file_spliter_key = "devicelookupfile.fieldspliter";
	
	private static String deviceLookupFile = null;
	private static String deviceLookupSpliter = null;
	
	static{
		try {
			portal.load(PortalProperties.class.getClassLoader().getResourceAsStream("portal.properties"));
			deviceLookupFile = getValue(device_lookup_file_key);
			deviceLookupSpliter =getValue(device_lookup_file_spliter_key);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	private static PortalProperties portalProperties = null;
	
	public static PortalProperties getInstance(){
		if(portalProperties == null){
			portalProperties = new PortalProperties();
		}
		return portalProperties;
	}
	
	public static String getValue(String key){
		return portal.getProperty(key);
	}

	public String getDeviceLookupFile() {
		return deviceLookupFile;
	}

	public String getDeviceLookupSpliter() {
		return deviceLookupSpliter;
	}
}
